<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib prefix="sys" uri="/WEB-INF/tld/sys.tld" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>抵押信息</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>
<body class="iframeBody">
	<div class="Wrapper">
       <div class="searchArea">
            <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox col_33" id="searchCstNmId">
                    <div class="label">客户名称</div>
                    <div class="field">
                        <input name="cstNm" id="cstNm" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                 <div class="fieldBox col_33" id="searchPayNo">
                    <div class="label">支付表号</div>
                    <div class="field">
                        <input name="paySchNo" id="paySchNo" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                 <div class="fieldBox col_33" >
                  <div class="label">我司抵押状态</div>
                    <div class="field">
                    <select name="guarStsCd"  id="guarStsCd" >
                     <option value="  " selected="selected">--请选择--</option>
                     <c:forEach items="${guarStsCdList}" var="opt">
                      <option value="${opt.key}">${opt.value}</option>
                     </c:forEach>
                    </select>
                    </div>
                </div>
                <div class="fieldBox col_33" >
                  <div class="label">抵押方式</div>
                    <div class="field">
                    <select name="mtgWayCd"  id="mtgWayCd" >
                     <option value="  " selected="selected">--请选择--</option>
                     <c:forEach items="${mtgWayList}" var="wayObj">
                      <option value="${wayObj.key}">${wayObj.value}</option>
                     </c:forEach>
                    </select>
                    </div>
                </div>
                <div class="fieldBox col_33" id="searchInsCodeId">
                    <div class="label">三方机构</div>
                    <div class="field">
                        <select name="insCode"  id="insCode" >
                            <option value="  " selected="selected">--请选择--</option>
                            <c:forEach items="${friBaseList}" var="fri">
                                <option value="${fri.insCode}">${fri.fundRasInsNm}</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>
                <div class="fieldBox col_33" >
                    <div class="label">资方抵押状态</div>
                    <div class="field">
                        <select name="zgGguarStsCd"  id="zgGguarStsCd"  >
                            <option value="  " selected="selected">--请选择--</option>
                             <c:forEach items="${mtgZgGuarList}" var="zgGuarObj">
                              <option value="${zgGuarObj.key}">${zgGuarObj.value}</option>
                             </c:forEach>
                       </select>
                    </div>
                </div>
                <div class="fieldBox col_33" >
                  <div class="label">抵押预警</div>
                    <div class="field">
                    <select name="warnStsCd"  id="warnStsCd" >
                     <option value="  " selected="selected">--请选择--</option>
                     <c:forEach items="${mtgWarnList}" var="warnObj">
                      <option value="${warnObj.key}">${warnObj.value}</option>
                     </c:forEach>
                    </select>
                    </div>
                </div>
                <div class="clearFix"></div>
                <div class="btnsBox">
                    <span id="searchBtn"  class="sq-button sq-button-round">查询</span>
                   <span id="clearBtn" onclick="clearBtn();" class="sq-button sq-button-round">清空</span>
                </div>
            </div>
            </form>
        </div>
        <div id="grid" class="sq-grid"></div>
    </div>
<script type="text/javascript">
    var grid = null, form = null;
    $(function () {
        initGrid();
        /* 查询 */
        $("#searchBtn").click(function (event) {
            form = liger.get("searchBar");
            var data = form.getData();
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            grid.reload();
            //detailGrid.reload();
        });
        /* 清空 */
        $("#clearBtn").click(function (event) {
            clearLigerForm("searchBar");
        });
    });

    /* 初始化列表*/
    function initGrid(){
        grid = $("#grid").ligerGrid({
                url: '<%=path%>/project/prjprdmtg/initWarnList.do',
                method: 'get',
                columns: [
                    { display: '状态', name: 'warnStsCd', width: 60 , align:'center', enabledSort:true,
	            	    render: function (rowdata, rowindex, value, column) {
		            		if(StringUtils.isEmpty(value)){
		                		value = "";
		                	}
		                	var imgpath = '';
		            		var g = '';
		                	if(rowdata.warnStsCd==5){//预警，红色
		                		imgpath = '<%=path%>/resource/lib/images/redpoticon.png';
		                		g = '<img alt="" width="20px" height="20px" src="'+imgpath+'">';
		                	}else if(rowdata.warnStsCd==4){//提醒 黄色
		                		imgpath = '<%=path%>/resource/lib/images/goldenpoticon.png';
		                		g = '<img alt="" width="20px" height="20px" src="'+imgpath+'">';
		                	}else{//其他不展示图片
		                	}
			                return g;
	            		}},
                    { display: '客户名称', name: 'cstNm', minWidth: 60,align:'left',enabledSort:true},
                    { display: '支付表号', name: 'paySchNo', minWidth: 100,align:'left',enabledSort:true},
                    { display: '设备名称', name: 'prdNm', minWidth: 80 ,align:'left',enabledSort:true},
                    { display: '设备型号', name: 'prdMdl', minWidth: 80,align:'left',enabledSort:true},
                    { display: '车架号', name: 'vin', minWidth: 80,align:'left',enabledSort:true},
                    { display: '所属机构', name: 'buOrgCdNm', minWidth: 80,align:'left',enabledSort:true},
                    { display: '省公司', name: 'prOrgCdNm', minWidth: 80,align:'left',enabledSort:true},
                    { display: '分公司', name: 'cyOrgCdNm', minWidth: 80,align:'left',enabledSort:true},
                    { display: '客户经理', name: 'cstMgrNm', minWidth: 80,align:'left',enabledSort:true},
                    { display: '我司抵押状态', name: 'guarStsCdNm', minWidth: 80 ,align:'center',enabledSort:true},
                    { display: '抵押方式', name: 'mtgWayCdNm', minWidth: 80,align:'left',enabledSort:true},
                    { display: '三方机构', name: 'fundRasInsNm', width: 100 , enabledSort:true},
                    { display: '资方抵押状态', name: 'zgGuarStsCdNm', width: 100 , enabledSort:true},
                    { display: '抵押截止日期', name: 'mgtEndDate', width: 100 , enabledSort:true},
                    { display: '资方放款时间', name: 'thdPayDt', width: 100 , render: renderDate, enabledSort:true},
                    { display: '抵押时效剩余天数', name: 'leftDays', width: 100 , enabledSort:true},
                    { display: '抵押预警', name: 'warnStsCdNm', width: 100 , enabledSort:true}
                ],
                pageSize: 10,
                root: 'rows',
                record: 'total',
                hideLoadButton: true,
                width: '100%',
                height: '100%',
                heightDiff: -2,
                allowUnSelectRow: true,
                alternatingRow: false,
                rownumbers: true,  //显示序号
                onBeforeShowData: function () {
                    var grid = this;
                    grid.collapsedRows = [];
                },
            })
        grid.setHeight(100);
        form = $("#searchBar").ligerForm();
    }
//格式化为人民币格式
	function renderAmt(rowdata, rowindex, value) {
        var h="￥" + FormatMoney(value)
        return h;
    }

	//格式化时间
	function renderDate(rowdata, index, value){
		var dateStr = "";
		if(null != value&&value!=''){
			var date = new Date(value);
			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
		}
		return dateStr;
	}
	function iframeResize () {
	    if (parent.mainApp) {
	        parent.mainApp.parentTab.onResize();
	    };
	}
</script>
</body>
</html>
